clear;clc;

Temp    =   load("../2_RobCheck_6_SubstitutionElasticity/Results_HighVsLowSubElas.mat");

TempList    =   {Temp.SOLUTION, Temp.SOLUTION_TN, Temp.SOLUTION_HF, Temp.SOLUTION_TN_HF, Temp.SOLUTION_TN_Low};
LabelList   =   {'Baseline','TN','HF','TN_HF', 'TN_Low'};

TempNum     =   length(TempList);
Tables      =   cell(TempNum,1);

parfor ii=1:TempNum
    vv          =   TempList{ii};
    Tables{ii}  =   SubFun_CollectResults(vv);
end

FileName    =   'TableGraphs\\ModelExtension_SubElast.xlsx';
ShockList   =   {'Eps_Eta_M_dom', 'Eps_Eta_Y_H', 'Eps_Eta_M_ext'};
for ii=1:length(ShockList)
    SH          =   ShockList{ii};
    TempData    =   [];
    for jj=1:TempNum
        TempData    =   [TempData,Tables{jj}.(SH)];
    end
    TempTable   =   array2table(TempData,'VariableNames',LabelList,'RowNames',Tables{1}.Row);
    writetable(TempTable,FileName,'WriteRowNames',true,'Sheet',SH);
end